import java.util.Scanner;

public class HelloWorldMenu
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner(System.in);
		System.out.println("Welcome to the menu!");
		String userSelection = "";
		
		while(!userSelection.equals("q") && !userSelection.equals("Q"))
		{
			System.out.println("------------------------");
			System.out.println("Please make a selection.");
			System.out.println("(A)dd");
			System.out.println("(S)ubtract");
			System.out.println("(M)ultiply");
			System.out.println("(D)ivide");
			System.out.println("(Q)uit");
			
			System.out.print("Selection: ");
			userSelection = input.next();
			
			switch(userSelection)
			{
				case "a":
				case "A":
					System.out.println("You selected ADD!");
					
					System.out.print("Please enter first number: ");
					String numStr1 = input.next();
					double num1 = Double.parseDouble(numStr1);
					
					System.out.print("Please enter second number: ");
					String numStr2 = input.next();
					double num2 = Double.parseDouble(numStr2);
					
					System.out.print(num1 + " + " + num2 + " = " + (num1 + num2));
					
					break;
				case "S":
				case "s":
					System.out.println("You selected SUBTRACT!");
					
					System.out.print("Please enter first number: ");
					String numStr3 = input.next();
					double num3 = Double.parseDouble(numStr3);
					
					System.out.print("Please enter second number: ");
					String numStr4 = input.next();
					double num4 = Double.parseDouble(numStr4);
					
					System.out.print(num3 + " - " + num4 + " = " + (num3 - num4));

					break;
				case "M":
				case "m":
					System.out.println("You selected MULTIPLY!");
					
					System.out.print("Please enter first number: ");
					String numStr5 = input.next();
					double num5 = Double.parseDouble(numStr5);
					
					System.out.print("Please enter second number: ");
					String numStr6 = input.next();
					double num6 = Double.parseDouble(numStr6);
					
					System.out.print(num5 + " * " + num6 + " = " + (num5 * num6));

					break;
				case "D":
				case "d":
					System.out.println("You have selected DIVIDE!");
					
					System.out.print("Please enter first number: ");
					String numStr7 = input.next();
					double num7 = Double.parseDouble(numStr7);
					
					System.out.print("Please enter second number: ");
					String numStr8 = input.next();
					double num8 = Double.parseDouble(numStr8);
					
					System.out.print(num7 + " / " + num8 + " = " + (num7 / num8));

					break;
				default:
					System.out.println("Invalid Selection");
					break;
				case "Q":
				case "q":
					System.out.println("You have QUIT!");
					return;
			}
		}
	}
	
}
